<!--
 * @Descripttion: 
 * @Version: 1.0
 * @Author: wcl
 * @Date: 2023-10-18 14:25:04
 * @LastEditors: wcl
 * @LastEditTime: 2023-10-18 15:26:50
-->
<template>
  <div class="flex">
    <!-- <div @click="handelMsg">
      <a-badge count="5">
        <img src="/image/rall.png" alt="" />
      </a-badge>
      <span class="msg">客服消息</span>
    </div> -->
    <div>
      <a-popover trigger="click">
        <template #content>
          <div class="popover-card">
            <div class="card-title">
              <img src="/image/tel_icon.png" alt="" />
              <span>联系平台</span>
            </div>
            <p>客服电话：0128-343728682</p>
            <p>客服电话：0128-343728682</p>
            <div class="card-btn">
              <div>
                <img src="/image/kf_icon.png" alt="" />
                <span>在线客服</span>
              </div>
              <div>
                <img src="/image/yj_icon.png" alt="" />
                <span>意见反馈</span>
              </div>
            </div>
          </div>
        </template>
        <img src="/image/tel.png" alt="" />
        <span>联系平台</span>
      </a-popover>
    </div>
    <div>
      <span>{{ userInfo.username }},欢迎你</span>
    </div>
    <div @click="logout">
      <span>退出</span>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
import { useUserStore } from "@/store/modules/user";
const router = useRouter();
const userStore = useUserStore();
const logout = () => {
  userStore.logout();
};
const userInfo = JSON.parse(sessionStorage.getItem("user")).userInfo;
console.log(userInfo);
const handelMsg = () => {
  const newBlank = router.resolve({ path: "/message" });
  window.open(newBlank.href, "_blank");
};
</script>

<style lang="less" scoped>
.flex {
  display: flex;
  align-items: center;
  color: #fff;
  > div {
    margin-left: 50px;
    cursor: pointer;
    color: #42495a;
    display: flex;
    align-items: center;
    .msg {
      color: #1990ff;
      margin-left: 10px;
    }
    img {
      width: 24px;
    }
  }
}
.popover-card {
  width: 350px;
  padding: 24px;
  p {
    font-size: 12px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #9599a5;
    line-height: 14px;
    margin-bottom: 8px;
    text-decoration: underline;
  }
  .card-title {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    img {
      width: 16px;
      height: 16px;
      margin-right: 4px;
    }
    span {
      font-size: 12px;
      font-family: PingFang SC-Regular, PingFang SC;
      font-weight: 400;
      color: #262e47;
      line-height: 14px;
      text-decoration: underline;
    }
  }
  .card-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    div {
      display: flex;
      align-items: center;
      justify-content: center;
      background: #eceef0;
      border-radius: 4px;
      padding: 4px 8px;
      margin-top: 16px;
      cursor: pointer;
      img {
        width: 16px;
        height: 16px;
        margin-right: 4px;
      }
      span {
        font-size: 12px;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        color: #262e47;
        line-height: 14px;
      }
    }
  }
}
</style>
